package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

@Entity
public class Returnorder {
    private int retuId;//id ok
    private String retuOrder;//发货单号 ok
    private String retuTheme;//退货主题 ok
    private Date retuTata;//退货时间 ok
    private BigDecimal retuYprice;//应退款 ok
    private BigDecimal retuSprice;//实退款
    private OrderInfo orderInfoByOrderId;//订单号 ok
    private List<Returnorderdetails> returnorderdetailsByRetuId; // ok
    private Integer retuState;//退货状态 ok
    private Integer retuUsertomid;//操作人 ok
    private String retuName;//退货编号
    private Integer retuWeixiu;//是否维修/retu_weixiu
    private Integer retuDeliveryid;//交付计划id/retu_deliveryid ok
    private Integer retuCustomerid;//客户id/retu_customerid ok

    @Id
    @Column(name = "retu_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getRetuId() {
        return retuId;
    }

    public void setRetuId(int retuId) {
        this.retuId = retuId;
    }

    @Basic
    @Column(name = "retu_order")
    public String getRetuOrder() {
        return retuOrder;
    }

    public void setRetuOrder(String retuOrder) {
        this.retuOrder = retuOrder;
    }

    @Basic
    @Column(name = "retu_theme")
    public String getRetuTheme() {
        return retuTheme;
    }

    public void setRetuTheme(String retuTheme) {
        this.retuTheme = retuTheme;
    }

    @Basic
    @Column(name = "retu_tata")
    public Date getRetuTata() {
        return retuTata;
    }

    public void setRetuTata(Date retuTata) {
        this.retuTata = retuTata;
    }

    @Basic
    @Column(name = "retu_yprice")
    public BigDecimal getRetuYprice() {
        return retuYprice;
    }

    public void setRetuYprice(BigDecimal retuYprice) {
        this.retuYprice = retuYprice;
    }

    @Basic
    @Column(name = "retu_sprice")
    public BigDecimal getRetuSprice() {
        return retuSprice;
    }

    public void setRetuSprice(BigDecimal retuSprice) {
        this.retuSprice = retuSprice;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Returnorder that = (Returnorder) o;
        return retuId == that.retuId &&
                Objects.equals(retuOrder, that.retuOrder) &&
                Objects.equals(retuTheme, that.retuTheme) &&
                Objects.equals(retuTata, that.retuTata) &&
                Objects.equals(retuYprice, that.retuYprice) &&
                Objects.equals(retuSprice, that.retuSprice);
    }

    @Override
    public int hashCode() {
        return Objects.hash(retuId, retuOrder, retuTheme, retuTata, retuYprice, retuSprice);
    }

    @ManyToOne
    @JoinColumn(name = "order_id", referencedColumnName = "order_id")
    public OrderInfo getOrderInfoByOrderId() {
        return orderInfoByOrderId;
    }

    public void setOrderInfoByOrderId(OrderInfo orderInfoByOrderId) {
        this.orderInfoByOrderId = orderInfoByOrderId;
    }

    @OneToMany(mappedBy = "returnorderByRetuId")
    public List<Returnorderdetails> getReturnorderdetailsByRetuId() {
        return returnorderdetailsByRetuId;
    }

    public void setReturnorderdetailsByRetuId(List<Returnorderdetails> returnorderdetailsByRetuId) {
        this.returnorderdetailsByRetuId = returnorderdetailsByRetuId;
    }

    @Basic
    @Column(name = "retu_state")
    public Integer getRetuState() {
        return retuState;
    }

    public void setRetuState(Integer retuState) {
        this.retuState = retuState;
    }

    @Basic
    @Column(name = "retu_usertomid")
    public Integer getRetuUsertomid() {
        return retuUsertomid;
    }

    public void setRetuUsertomid(Integer retuUsertomid) {
        this.retuUsertomid = retuUsertomid;
    }

    @Basic
    @Column(name = "retu_name")
    public String getRetuName() {
        return retuName;
    }

    public void setRetuName(String retuName) {
        this.retuName = retuName;
    }


    @Basic
    @Column(name = "retu_weixiu")
    public Integer getRetuWeixiu() {
        return retuWeixiu;
    }

    public void setRetuWeixiu(Integer retuWeixiu) {
        this.retuWeixiu = retuWeixiu;
    }

    @Basic
    @Column(name = "retu_deliveryid")
    public Integer getRetuDeliveryid() {
        return retuDeliveryid;
    }


    public void setRetuDeliveryid(Integer retuDeliveryid) {
        this.retuDeliveryid = retuDeliveryid;
    }

    @Basic
    @Column(name = "retu_customerid")
    public Integer getRetuCustomerid() {
        return retuCustomerid;
    }

    public void setRetuCustomerid(Integer retuCustomerid) {
        this.retuCustomerid = retuCustomerid;
    }

    /*@Override
    public String toString() {
        return "Returnorder{" +
                "retuId=" + retuId +
                ", retuOrder='" + retuOrder + '\'' +
                ", retuTheme='" + retuTheme + '\'' +
                ", retuTata=" + retuTata +
                ", retuYprice=" + retuYprice +
                ", retuSprice=" + retuSprice +
                ", orderInfoByOrderId=" + orderInfoByOrderId +
                ", returnorderdetailsByRetuId=" + returnorderdetailsByRetuId +
                ", retuState=" + retuState +
                ", retuUsertomid=" + retuUsertomid +
                ", retuName='" + retuName + '\'' +
                ", retuWeixiu=" + retuWeixiu +
                ", retuDeliveryid=" + retuDeliveryid +
                ", retuCustomerid=" + retuCustomerid +
                '}';
    }*/
}
